﻿using Microsoft.VisualBasic;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using Xceed.Wpf.Toolkit.PropertyGrid;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;

namespace 反射和特性
{
    public class ClassDemo
    {

        public void Run()
        {
            var p = new PropertyGrid();
            p.SelectedObject = new Employee() { };

        }
    }

    public class Employee
    {
        [Browsable(false)]
        public Guid Id { get; set; }
        [Category("Information")]
        [PropertyOrder(0)]
        public string Name { get; set; }
        [Category("Information")]
        [PropertyOrder(1)]
        public int Age => DateTime.Today.Year - DateOfBirth.Year;
        [Category("Information")]
        [PropertyOrder(2)]
        public Gender Gender { get; set; }
        [Category("Information")]
        [PropertyOrder(3)]
        public DateTime DateOfBirth { get; set; }

        [Range(0,100000)]
        [Category("Job")]
        public int Salary { get; set; }
        [Category("Job")]
        public bool IsManager { get; set; }  
        public List<string> Skills { get; set; }
    }

    public enum Gender
    {
        Female,
        male,
    }

}
